# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=python-markdown2
pkgver=2.4.8
pkgrel=2
pkgdesc='A fast and complete implementation of Markdown in Python'
arch=('any')
url='https://github.com/trentm/python-markdown2'
license=('MIT')
depends=('python' 'python-pygments')
makedepends=('python-setuptools')
checkdepends=('python-tox-current-env')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha512sums=('341bcc9947074e6339ffadb31b0d107f6fa4d6a1f9559c73700ec5a8e83aeca748154965ede6fa9b6e53ec68d9cbf5827638c8448c10ba049e0472215935e760')

build() {
  cd $pkgname-$pkgver

  python setup.py build
}

check() {
  cd $pkgname-$pkgver

  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  tox -e "py${python_version}" --current-env
}

package() {
  cd $pkgname-$pkgver

  python setup.py install --root="$pkgdir" --optimize=1 --skip-build

  install -Dm 644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
